/*
 * Copyright (C), 2002-2017, 南京苏宁软件技术有限公司
 * FileName: DistributeStatusDaoImpl.java
 * Author:   10070706
 * Date:     2017年1月9日 下午5:51:17
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.service.impl.dao.mainpushnew;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.intf.dao.mainpushnew.DistributeStatusDao;
import com.suning.sawp.po.mainpushnew.AreaTask;

/**
 * 功能简述: 分配状态Dao<br>
 *
 * @author 10070706 陈辉
 */
@Repository
public class DistributeStatusDaoImpl implements DistributeStatusDao {

    @Autowired
    private DalClient dalClient;

    @SuppressWarnings("unchecked")
    @Override
    public void modifyAreaTaskStatusByIds(List<AreaTask> areaTaskStatus) {
        Map<String, Object>[] params = new Map[areaTaskStatus.size()];
        Map<String, Object> param = null;
        AreaTask status = null;
        for (int i = 0; i < areaTaskStatus.size(); i++) {
            status = areaTaskStatus.get(i);
            param = new HashMap<String, Object>();
            param.put("id", status.getId());
            param.put("distStatus", status.getDistStatus());
            params[i] = param;
        }
        dalClient.batchUpdate("distributeStatus.modifyAreaTaskStatusById", params);
    }

    @Override
    public void modifyAreaTaskStatusById(Long areaTaskId, Short distStatus) {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("id", areaTaskId);
        param.put("distStatus", distStatus);
        dalClient.execute("distributeStatus.modifyAreaTaskStatusById", param);
    }

    @Override
    public void modifyAreaTaskRelStatusById(Long areaTaskRelId, Short distStatus) {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("id", areaTaskRelId);
        param.put("distStatus", distStatus);
        dalClient.execute("distributeStatus.modifyAreaTaskRelStatusById", param);
    }

}
